<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>flex-wrap</title>
    <style>
      .flex-container {
        display: -webkit-flex;
        display: flex;
        width: auto;
        height: 150px;
        background-color: lightgrey;
      }

      .flex-item {
        background-color: cornflowerblue;
        width: 100px;
        height: 100px;
        margin: 10px;
        text-align: center;
      }
    </style>
  </head>

  <body>
    <h1>flex-wrap 属性用于指定弹性盒子的子元素换行方式。</h1>

    <h2>
      flex-wrap: nowrap 默认， 弹性容器为单行。该情况下弹性子项可能会溢出容器。
    </h2>
    <div class="flex-container" style="flex-wrap: nowrap">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>
    <br />
    <div
      class="flex-container"
      style="width: 300px; height: 200px; flex-wrap: nowrap"
    >
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      flex-wrap: wrap
      弹性容器为多行。该情况下弹性子项溢出的部分会被放置到新行，子项内部会发生断行
    </h2>
    <div
      class="flex-container"
      style="width: 300px; height: auto; flex-wrap: wrap"
    >
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>flex-wrap: wrap-reverse 反转 wrap 排列。</h2>
    <div
      class="flex-container"
      style="width: 300px; height: auto; flex-wrap: wrap-reverse"
    >
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>
  </body>
</html>
